<template>
	<view>
		<view class="content bg-white margin-top">
			<view class="cu-form-group padding align-start">
				<view class="title padding-left-sm">原因</view>
				<textarea maxlength="200" v-model="context" placeholder="请填写原因"></textarea>
			</view>

			<view class="flex flex-direction margin">
				<button class="cu-btn bg-red margin-tb-sm lg" @click="submitStoreOrderCartReturn()">退货</button>
			</view>

		</view>
	</view>
</template>

<script>


	import {returnStoreOrderCart} from '../../api/order/orderApi.js'
	export default {
		data() {
			return {
				fontSize:'60upx',
				context: '',
				shopId:'',
				cartId:'',
				orderId:'',
				userId:'',
				userName:''
			}
		},
		onLoad(options) {
			let _that = this;
			this.vc.onLoad(options);
			this.orderId = options.orderId;
			this.cartId = options.cartId;
			this.shopId = options.shopId;
		},
		methods: {
			submitStoreOrderCartReturn:function(){
				if(this.context == ''){
					uni.showToast({
						title:'请填写退款内容',
						icon:'none'
					});
					return ;
				}
				returnStoreOrderCart({
					"shopId":this.shopId,
					 "returnReason":this.context,
					 "personId":this.vc.getCurrentUser().userId,
					 "orderId":this.orderId,
					 "cartId":this.cartId
				})
				.then((_data)=>{
					wx.showToast({
						title: '成功',
						icon: 'none',
						duration: 2000
					});
					wx.hideLoading();
					uni.navigateBack({
						delta: 1
					});
				},(error)=>{
					wx.showToast({
						title: error,
						icon: 'none',
						duration: 2000
					});
				});
			}
		}
	}
</script>

<style>
	.content {
		height: 100%;
	}
</style>
